// DMS Donations Management System v1.0                 
// created by:  Isaac Sabas                   
//				Nikko Reyes
//				Miko Tiamwatt          
//                                                      
// De La Salle Philippines                              
// All Rights Reserved DLSP Copyright 2009        

function open_primary_window(call_purpose, client_id, donation_id, call_id) {
	if (call_purpose == 'For Initial Call' || call_purpose == 'For Follow-up' || call_purpose == 'Others') {		
		open_client_window(call_id, client_id);		
	}
	else if (call_purpose == 'For Pickup Reminder' || call_purpose == 'For Pickup Acknowledgement') {
		open_donation_ticket(call_id, donation_id, client_id);
		//alert('ok');		
	}	
}

function hide_client_item( id ) {		
	YAHOO.dms.done_confirmation_dialog[id].close_dialog();
	window.frames.dashboard_client_content.xajax_doneCall(id);
}

//---------------------------
// MODAL DIALOG CONFIRMATION
//---------------------------

//----------------------------------
// edit client profile modal dialogs
//----------------------------------
function edit_client_name(id) {
	// check first if the instance of that window exist, if not procede with building the modal confirmation window
		if (!YAHOO.dms.client_edit_name_dialog[id]) {
			var window_name = "client_edit_name_dialog_" + id;	// window id
			var window_close = "client_edit_name_dialog_" + id;// window close button id	
	
			// build the modal wind	w (refer to YUI documentation for more information
				YAHOO.dms.client_edit_name_dialog[id] = new YAHOO.widget.Panel(window_name, { 
					width:"280px", 
					height:"240px", 
					fixedcenter:true, 
					close:false, 
					draggable:false, 
					zindex:4,
					modal:true,
					visible:true  } );	
				
				YAHOO.dms.client_edit_name_dialog[id].setHeader("Edit Client Name:");
				YAHOO.dms.client_edit_name_dialog[id].setBody("<iframe id='client_edit_name_" + id + "' name='client_edit_name_" + id + "' src='dashboard/windows/ClientEditNameWindow.php?client_id=" + id + "' width=290 height=170 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=auto style='overflow-x: hidden;'></iframe> <input type='button' value='Close' onclick='YAHOO.dms.client_edit_name_dialog[" + id + "].hide()' />");
				YAHOO.dms.client_edit_name_dialog[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.client_edit_name_dialog[id].focus, YAHOO.dms.client_edit_name_dialog[id], true);  
		}
		else {
			window.frames["client_edit_name_"+ id].location.reload();
			YAHOO.dms.client_edit_name_dialog[id].show();
		}	
}

function edit_client_gender(id) {
	// check first if the instance of that window exist, if not procede with building the modal confirmation window
		if (!YAHOO.dms.client_edit_gender_dialog[id]) {
			var window_name = "client_edit_gender_dialog_" + id;	// window id
			var window_close = "client_edit_gender_dialog_" + id;// window close button id	
	
			// build the modal wind	w (refer to YUI documentation for more information
				YAHOO.dms.client_edit_gender_dialog[id] = new YAHOO.widget.Panel(window_name, { 
					width:"190px", 
					height:"190px", 
					fixedcenter:true, 
					close:false,
					draggable:false, 
					zindex:4,
					modal:true,
					visible:true  } );	
			
				YAHOO.dms.client_edit_gender_dialog[id].setHeader("Edit Client Gender:");
				YAHOO.dms.client_edit_gender_dialog[id].setBody("<iframe id='client_edit_gender_" + id + "' name='client_edit_gender_" + id + "' src='dashboard/windows/ClientEditGenderWindow.php?client_id= " + id + "' width=180 height=120 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=auto style='overflow-x: hidden;'></iframe> <input type='button' value='Close' onclick='YAHOO.dms.client_edit_gender_dialog[" + id + "].hide()' />");
				YAHOO.dms.client_edit_gender_dialog[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.client_edit_gender_dialog[id].focus, YAHOO.dms.client_edit_gender_dialog[id], true);  
		}	
		else {
			window.frames["client_edit_gender_" + id].location.reload();
			YAHOO.dms.client_edit_gender_dialog[id].show();
		}
}

function edit_client_birthdate(id) {
	// check first if the instance of that window exist, if not procede with building the modal confirmation window
		if (!YAHOO.dms.client_edit_birthdate_dialog[id]) {
			var window_name = "client_edit_birthdate_dialog_" + id;	// window id
			var window_close = "client_edit_birthdate_dialog_" + id;// window close button id	
	
			// build the modal wind	w (refer to YUI documentation for more information
				YAHOO.dms.client_edit_birthdate_dialog[id] = new YAHOO.widget.Panel(window_name, { 
					width:"210px", 
					height:"240px", 
					fixedcenter:true, 
					close:false, 
					draggable:false, 
					zindex:4,
					modal:true,
					visible:true  } );	
			
				YAHOO.dms.client_edit_birthdate_dialog[id].setHeader("Edit Client Birthdate:");
				YAHOO.dms.client_edit_birthdate_dialog[id].setBody("<iframe id='client_edit_birthdate_" + id + "' name='client_edit_birthdate_" + id + "' src='dashboard/windows/ClientEditBirthdateWindow.php?client_id= " + id + "' width=200 height=170 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=auto style='overflow-x: hidden;'></iframe> <input type='button' value='Close' onclick='YAHOO.dms.client_edit_birthdate_dialog[" + id + "].hide()' />");
				YAHOO.dms.client_edit_birthdate_dialog[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.client_edit_birthdate_dialog[id].focus, YAHOO.dms.client_edit_birthdate_dialog[id], true);  
		}	
		else {
			window.frames["client_edit_birthdate_"+ id].location.reload();
			YAHOO.dms.client_edit_birthdate_dialog[id].show();
		}
}

function edit_client_address(id) {
	// check first if the instance of that window exist, if not procede with building the modal confirmation window
		if (!YAHOO.dms.client_edit_address_dialog[id]) {
			var window_name = "client_edit_address_dialog_" + id;	// window id
			var window_close = "client_edit_address_dialog_" + id;// window close button id	
	
			// build the modal wind	w (refer to YUI documentation for more information
				YAHOO.dms.client_edit_address_dialog[id] = new YAHOO.widget.Panel(window_name, { 
					width:"300px", 
					height:"370px", 
					fixedcenter:true, 
					close:false, 
					draggable:false, 
					zindex:4,
					modal:true,
					visible:true  } );	
			
				YAHOO.dms.client_edit_address_dialog[id].setHeader("Edit Client Address:");
				YAHOO.dms.client_edit_address_dialog[id].setBody("<iframe id='client_edit_address_" + id + "' name='client_edit_address_" + id + "' src='dashboard/windows/ClientEditAddressWindow.php?client_id= " + id + "' width=290 height=300 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=auto style='overflow-x: hidden;'></iframe> <input type='button' value='Close' onclick='YAHOO.dms.client_edit_address_dialog[" + id + "].hide()' />");
				YAHOO.dms.client_edit_address_dialog[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.client_edit_address_dialog[id].focus, YAHOO.dms.client_edit_address_dialog[id], true);  
		}	
		else {
			window.frames["client_edit_address_"+ id].location.reload();
			YAHOO.dms.client_edit_address_dialog[id].show();
		}
}

function add_client_address(id) {
	// check first if the instance of that window exist, if not procede with building the modal confirmation window
		if (!YAHOO.dms.client_add_address_dialog[id]) {
			var window_name = "client_add_address_dialog_" + id;	// window id
			var window_close = "client_add_address_dialog_" + id;// window close button id	
	
			// build the modal wind	w (refer to YUI documentation for more information
				YAHOO.dms.client_add_address_dialog[id] = new YAHOO.widget.Panel(window_name, { 
					width:"300px", 
					height:"350px", 
					fixedcenter:true, 
					close:false, 
					draggable:false, 
					zindex:4,
					modal:true,
					visible:true  } );	
			
				YAHOO.dms.client_add_address_dialog[id].setHeader("Add Client Address:");
				YAHOO.dms.client_add_address_dialog[id].setBody("<iframe id='client_add_address_" + id + "' name='client_add_address_" + id + "' src='dashboard/windows/ClientAddAddressWindow.php?client_id= " + id + "' width=290 height=280 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=auto style='overflow-x: hidden;'></iframe> <input type='button' value='Close' onclick='YAHOO.dms.client_add_address_dialog[" + id + "].hide()' />");
				YAHOO.dms.client_add_address_dialog[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.client_add_address_dialog[id].focus, YAHOO.dms.client_add_address_dialog[id], true);  
		}	
		else {
			window.frames["client_add_address_"+ id].location.reload();
			YAHOO.dms.client_add_address_dialog[id].show();
		}
}

function add_client_phone(id) {
	// check first if the instance of that window exist, if not procede with building the modal confirmation window
		if (!YAHOO.dms.client_add_phone_dialog[id]) {
			var window_name = "client_add_phone_dialog_" + id;	// window id
			var window_close = "client_add_phone_dialog_" + id;// window close button id	
	
			// build the modal wind	w (refer to YUI documentation for more information
				YAHOO.dms.client_add_phone_dialog[id] = new YAHOO.widget.Panel(window_name, { 
					width:"300px", 
					height:"290px", 
					fixedcenter:true, 
					close:false, 
					draggable:false, 
					zindex:4,
					modal:true,
					visible:true  } );	
			
				YAHOO.dms.client_add_phone_dialog[id].setHeader("Add Client Phone:");
				YAHOO.dms.client_add_phone_dialog[id].setBody("<iframe id='client_add_phone_" + id + "' name='client_add_phone_" + id + "' src='dashboard/windows/ClientAddPhoneWindow.php?client_id= " + id + "' width=290 height=220 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=auto style='overflow-x: hidden;'></iframe> <input type='button' value='Close' onclick='YAHOO.dms.client_add_phone_dialog[" + id + "].hide()' />");
				YAHOO.dms.client_add_phone_dialog[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.client_add_phone_dialog[id].focus, YAHOO.dms.client_add_phone_dialog[id], true);  
		}	
		else {
			window.frames["client_add_phone_"+ id].location.reload();
			YAHOO.dms.client_add_phone_dialog[id].show();
		}
}

function edit_client_phone(id) {
	// check first if the instance of that window exist, if not procede with building the modal confirmation window
		if (!YAHOO.dms.client_edit_phone_dialog[id]) {
			var window_name = "client_edit_phone_dialog_" + id;	// window id
			var window_close = "client_edit_phone_dialog_" + id;// window close button id	
	
			// build the modal wind	w (refer to YUI documentation for more information
				YAHOO.dms.client_edit_phone_dialog[id] = new YAHOO.widget.Panel(window_name, { 
					width:"300px", 
					height:"370px", 
					fixedcenter:true, 
					close:false, 
					draggable:false, 
					zindex:4,
					modal:true,
					visible:true  } );	
			
				YAHOO.dms.client_edit_phone_dialog[id].setHeader("Edit Client Phone:");
				YAHOO.dms.client_edit_phone_dialog[id].setBody("<iframe id='client_edit_phone_" + id + "' name='client_edit_phone_" + id + "' src='dashboard/windows/ClientEditPhoneWindow.php?client_id= " + id + "' width=290 height=300 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=auto style='overflow-x: hidden;'></iframe> <input type='button' value='Close' onclick='YAHOO.dms.client_edit_phone_dialog[" + id + "].hide()' />");
				YAHOO.dms.client_edit_phone_dialog[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.client_edit_phone_dialog[id].focus, YAHOO.dms.client_edit_phone_dialog[id], true);  
		}	
		else {
			window.frames["client_edit_phone_"+ id].location.reload();
			YAHOO.dms.client_edit_phone_dialog[id].show();
		}
}

function edit_client_email(id) {
	// check first if the instance of that window exist, if not procede with building the modal confirmation window
		if (!YAHOO.dms.client_edit_email_dialog[id]) {
			var window_name = "client_edit_email_dialog_" + id;	// window id
			var window_close = "client_edit_email_dialog_" + id;// window close button id	
	
			// build the modal wind	w (refer to YUI documentation for more information
				YAHOO.dms.client_edit_email_dialog[id] = new YAHOO.widget.Panel(window_name, { 
					width:"240px", 
					height:"190px", 
					fixedcenter:true, 
					close:false, 
					draggable:false, 
					zindex:4,
					modal:true,
					visible:true  } );	

				YAHOO.dms.client_edit_email_dialog[id].setHeader("Edit Client Email:");
				YAHOO.dms.client_edit_email_dialog[id].setBody("<iframe id='client_edit_email_" + id + "' name='client_edit_email_" + id + "' src='dashboard/windows/ClientEditEmailWindow.php?client_id= " + id + "' width=230 height=120 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=auto style='overflow-x: hidden;'></iframe> <input type='button' value='Close' onclick='YAHOO.dms.client_edit_email_dialog[" + id + "].hide()' />");
				YAHOO.dms.client_edit_email_dialog[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.client_edit_email_dialog[id].focus, YAHOO.dms.client_edit_email_dialog[id], true);  
		}	
		else {
			window.frames["client_edit_email_"+ id].location.reload();
			YAHOO.dms.client_edit_email_dialog[id].show();
		}
}

function edit_client_school(id) {
	// check first if the instance of that window exist, if not procede with building the modal confirmation window
		if (!YAHOO.dms.client_edit_school_dialog[id]) {
			var window_name = "client_edit_school_dialog_" + id;	// window id
			var window_close = "client_edit_school_dialog_" + id;// window close button id	
	
			// build the modal wind	w (refer to YUI documentation for more information
				YAHOO.dms.client_edit_school_dialog[id] = new YAHOO.widget.Panel(window_name, { 
					width:"240px", 
					height:"190px", 
					fixedcenter:true, 
					close:false, 
					draggable:false, 
					zindex:4,
					modal:true,
					visible:true  } );	

				YAHOO.dms.client_edit_school_dialog[id].setHeader("Edit Client School:");
				YAHOO.dms.client_edit_school_dialog[id].setBody("<iframe id='client_edit_school_" + id + "' name='client_edit_school_" + id + "' src='dashboard/windows/ClientEditSchoolWindow.php?client_id= " + id + "' width=230 height=120 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=auto style='overflow-x: hidden;'></iframe> <input type='button' value='Close' onclick='YAHOO.dms.client_edit_school_dialog[" + id + "].hide()' />");
				YAHOO.dms.client_edit_school_dialog[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.client_edit_school_dialog[id].focus, YAHOO.dms.client_edit_school_dialog[id], true);  
		}	
		else {
			window.frames["client_edit_school_"+ id].location.reload();
			YAHOO.dms.client_edit_school_dialog[id].show();
		}
}

function edit_client_course(id) {
	// check first if the instance of that window exist, if not procede with building the modal confirmation window
		if (!YAHOO.dms.client_edit_course_dialog[id]) {
			var window_name = "client_edit_course_dialog_" + id;	// window id
			var window_close = "client_edit_course_dialog_" + id;// window close button id	
	
			// build the modal wind	w (refer to YUI documentation for more information
				YAHOO.dms.client_edit_course_dialog[id] = new YAHOO.widget.Panel(window_name, { 
					width:"280px", 
					height:"220px", 
					fixedcenter:true, 
					close:false, 
					draggable:false, 
					zindex:4,
					modal:true,
					visible:true  } );	
			
				YAHOO.dms.client_edit_course_dialog[id].setHeader("Edit Client Course:");
				YAHOO.dms.client_edit_course_dialog[id].setBody("<iframe id='client_edit_course_" + id + "' name='client_edit_course_" + id + "' src='dashboard/windows/ClientEditCourseWindow.php?client_id= " + id + "' width=270 height=150 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=auto style='overflow-x: hidden;'></iframe> <input type='button' value='Close' onclick='YAHOO.dms.client_edit_course_dialog[" + id + "].hide()' />");
				YAHOO.dms.client_edit_course_dialog[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.client_edit_course_dialog[id].focus, YAHOO.dms.client_edit_course_dialog[id], true);  
		}	
		else {
			window.frames["client_edit_course_"+ id].location.reload();
			YAHOO.dms.client_edit_course_dialog[id].show();
		}
}

function edit_client_graduate(id) {
	// check first if the instance of that window exist, if not procede with building the modal confirmation window
		if (!YAHOO.dms.client_edit_graduate_dialog[id]) {
			var window_name = "client_edit_graduate_dialog_" + id;	// window id
			var window_close = "client_edit_graduate_dialog_" + id;// window close button id	
	
			// build the modal wind	w (refer to YUI documentation for more information
				YAHOO.dms.client_edit_graduate_dialog[id] = new YAHOO.widget.Panel(window_name, { 
					width:"280px", 
					height:"220px", 
					fixedcenter:true, 
					close:false, 
					draggable:false, 
					zindex:4,
					modal:true,
					visible:true  } );	
			
				YAHOO.dms.client_edit_graduate_dialog[id].setHeader("Edit Client Graduate:");
				YAHOO.dms.client_edit_graduate_dialog[id].setBody("<iframe id='client_edit_graduate_" + id + "' name='client_edit_graduate_" + id + "' src='dashboard/windows/ClientEditGraduateWindow.php?client_id= " + id + "' width=270 height=150 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=auto style='overflow-x: hidden;'></iframe> <input type='button' value='Close' onclick='YAHOO.dms.client_edit_graduate_dialog[" + id + "].hide()' />");
				YAHOO.dms.client_edit_graduate_dialog[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.client_edit_graduate_dialog[id].focus, YAHOO.dms.client_edit_graduate_dialog[id], true);  
		}	
		else {
			window.frames["client_edit_graduate_"+ id].location.reload();
			YAHOO.dms.client_edit_graduate_dialog[id].show();
		}
}

function edit_client_company(id) {
	// check first if the instance of that window exist, if not procede with building the modal confirmation window
		if (!YAHOO.dms.client_edit_company_dialog[id]) {
			var window_name = "client_edit_company_dialog_" + id;	// window id
			var window_close = "client_edit_company_dialog_" + id;// window close button id	
	
			// build the modal wind	w (refer to YUI documentation for more information
				YAHOO.dms.client_edit_company_dialog[id] = new YAHOO.widget.Panel(window_name, { 
					width:"250px", 
					height:"190px", 
					fixedcenter:true, 
					close:false, 
					draggable:false, 
					zindex:4,
					modal:true,
					visible:true  } );	
			
				YAHOO.dms.client_edit_company_dialog[id].setHeader("Edit Client Company:");
				YAHOO.dms.client_edit_company_dialog[id].setBody("<iframe id='client_edit_company_" + id + "' name='client_edit_company_" + id + "' src='dashboard/windows/ClientEditCompanyWindow.php?client_id= " + id + "' width=240 height=120 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=auto style='overflow-x: hidden;'></iframe> <input type='button' value='Close' onclick='YAHOO.dms.client_edit_company_dialog[" + id + "].hide()' />");
				YAHOO.dms.client_edit_company_dialog[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.client_edit_company_dialog[id].focus, YAHOO.dms.client_edit_company_dialog[id], true);  
		}	
		else {
			window.frames["client_edit_company_"+ id].location.reload();
			YAHOO.dms.client_edit_company_dialog[id].show();
		}
}

function edit_client_position(id) {
	// check first if the instance of that window exist, if not procede with building the modal confirmation window
		if (!YAHOO.dms.client_edit_position_dialog[id]) {
			var window_name = "client_edit_position_dialog_" + id;	// window id
			var window_close = "client_edit_position_dialog_" + id;// window close button id	
	
			// build the modal wind	w (refer to YUI documentation for more information
				YAHOO.dms.client_edit_position_dialog[id] = new YAHOO.widget.Panel(window_name, { 
					width:"240px", 
					height:"190px", 
					fixedcenter:true, 
					close:false, 
					draggable:false, 
					zindex:4,
					modal:true,
					visible:true  } );	
				
				YAHOO.dms.client_edit_position_dialog[id].setHeader("Edit Client Position:");
				YAHOO.dms.client_edit_position_dialog[id].setBody("<iframe id='client_edit_position_" + id + "' name='client_edit_position_" + id + "' src='dashboard/windows/ClientEditPositionWindow.php?client_id= " + id + "' width=230 height=120 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=auto style='overflow-x: hidden;'></iframe> <input type='button' value='Close' onclick='YAHOO.dms.client_edit_position_dialog[" + id + "].hide()' />");
				YAHOO.dms.client_edit_position_dialog[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.client_edit_position_dialog[id].focus, YAHOO.dms.client_edit_position_dialog[id], true);  
		}	
		else {
			window.frames["client_edit_position_"+ id].location.reload();
			YAHOO.dms.client_edit_position_dialog[id].show();
		}
}

function edit_client_companyaddress(id) {
	// check first if the instance of that window exist, if not procede with building the modal confirmation window
		if (!YAHOO.dms.client_edit_companyaddress_dialog[id]) {
			var window_name = "client_edit_companyaddress_dialog_" + id;	// window id
			var window_close = "client_edit_companyaddress_dialog_" + id;// window close button id	
	
			// build the modal wind	w (refer to YUI documentation for more information
				YAHOO.dms.client_edit_companyaddress_dialog[id] = new YAHOO.widget.Panel(window_name, { 
					width:"300px", 
					height:"320px", 
					fixedcenter:true, 
					close:false, 
					draggable:false, 
					zindex:4,
					modal:true,
					visible:true  } );	
			
				YAHOO.dms.client_edit_companyaddress_dialog[id].setHeader("Edit Client Company Address:");
				YAHOO.dms.client_edit_companyaddress_dialog[id].setBody("<iframe id='client_edit_companyaddress_" + id + "' name='client_edit_companyaddress_" + id + "' src='dashboard/windows/ClientEditCompanyAddressWindow.php?client_id= " + id + "' width=290 height=250 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=auto style='overflow-x: hidden;'></iframe> <input type='button' value='Close' onclick='YAHOO.dms.client_edit_companyaddress_dialog[" + id + "].hide()' />");
				YAHOO.dms.client_edit_companyaddress_dialog[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.client_edit_companyaddress_dialog[id].focus, YAHOO.dms.client_edit_companyaddress_dialog[id], true);  
		}	
		else {
			window.frames["client_edit_companyaddress_"+ id].location.reload();
			YAHOO.dms.client_edit_companyaddress_dialog[id].show();
		}
}

function edit_client_misc(id) {
	// check first if the instance of that window exist, if not procede with building the modal confirmation window
		if (!YAHOO.dms.client_edit_misc_dialog[id]) {
			var window_misc = "client_edit_misc_dialog_" + id;	// window id
			var window_close = "client_edit_misc_dialog_" + id;// window close button id	
	
			// build the modal wind	w (refer to YUI documentation for more information
				YAHOO.dms.client_edit_misc_dialog[id] = new YAHOO.widget.Panel(window_misc, { 
					width:"250px", 
					height:"290px", 
					fixedcenter:true, 
					close:false, 
					draggable:false, 
					zindex:4,
					modal:true,
					visible:true  } );
				
				YAHOO.dms.client_edit_misc_dialog[id].setHeader("Edit Client Misc:");
				YAHOO.dms.client_edit_misc_dialog[id].setBody("<iframe id='client_edit_misc_" + id + "' name='client_edit_misc_" + id + "' src='dashboard/windows/ClientEditMiscWindow.php?client_id=" + id + "' width=240 height=220 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=auto style='overflow-x: hidden;'></iframe> <input type='button' value='Close' onclick='YAHOO.dms.client_edit_misc_dialog[" + id + "].hide()' />");
				YAHOO.dms.client_edit_misc_dialog[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_misc, window_close, YAHOO.dms.client_edit_misc_dialog[id].focus, YAHOO.dms.client_edit_misc_dialog[id], true);  
		}
		else {
			window.frames["client_edit_misc_"+ id].location.reload();
			YAHOO.dms.client_edit_misc_dialog[id].show();
		}	
}

//--------------------------
// confirmation modal dialog
//--------------------------
// opens the reschedule confirmation upon clicking done in the reschedule window
function show_reschedule_confirmation( id ) { // the id used here is the donation id
	// check first if the instance of that window exist, if not procede with building the modal confirmation window
		if (!YAHOO.dms.reschedule_dialog[id]) {
			var window_name = "reschedule_dialog_" + id; 	// window id
			var window_close = "reschedule_dialog_" + id;	// window close button id
	
			// build the modal window (refer to YUI documentation for more information
				YAHOO.dms.reschedule_dialog[id] = new YAHOO.widget.Panel(window_name, { 
					width:"240px", 
					height:"100px", 
					fixedcenter:true, 
					close:false, 
					draggable:false, 
					zindex:4,
					modal:true,
					visible:true  } );	
				
				YAHOO.dms.reschedule_dialog[id].setHeader("Reschedule Pickup Date:");
				// set the body content
					YAHOO.dms.reschedule_dialog[id].setBody("Are you sure you want to reschedule donation pickup date?<br /><input type='button' value='Yes' onclick=\"window.frames.reschedule_window_"+id+".xajax_reschedulePickup(window.frames.reschedule_window_"+id+".xajax.getFormValues('rescheduleForm'))\" /><input type='button' value='No' onclick='YAHOO.dms.reschedule_dialog[" + id + "].hide()' />");
				YAHOO.dms.reschedule_dialog[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.reschedule_dialog[id].focus, YAHOO.dms.reschedule_dialog[id], true);  
		}	
		else {
			YAHOO.dms.reschedule_dialog[id].show();
		}
}



function show_close_donation_confirmation( id ) {
	// check first if the instance of that window exist, if not procede with building the modal confirmation window
		if (!YAHOO.dms.close_donation_dialog[id]) {
			var window_name = "close_donation_dialog_" + id;	// window id
			var window_close = "close_donation_dialog_" + id;	// window close button id
			
			// build the modal window (refer to YUI documentation for more information
				YAHOO.dms.close_donation_dialog[id] = new YAHOO.widget.Panel(window_name, { 
					width:"240px", 
					height:"100px", 
					fixedcenter:true, 
					close:false, 
					draggable:false, 
					zindex:4,
					modal:true,
					visible:true  } );	
			
				YAHOO.dms.close_donation_dialog[id].setHeader("Complete Close Donation:");
				YAHOO.dms.close_donation_dialog[id].setBody("Are you sure you want to close this donation ticket?<br /><input type='button' value='Yes' onclick='window.frames.discontinuation_window_"+id+".xajax_discontinueDonation("+id+")' /><input type='button' value='No' onclick='YAHOO.dms.close_donation_dialog[" + id + "].hide()' />");
				YAHOO.dms.close_donation_dialog[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.close_donation_dialog[id].focus, YAHOO.dms.close_donation_dialog[id], true);  
		}	
		else {
			YAHOO.dms.close_donation_dialog[id].show();
		}
}

function show_cancel_donation_confirmation( id ) { // the id used here is the donation id
	// check first if the instance of that window exist, if not procede with building the modal confirmation window	
		if (!YAHOO.dms.cancel_donation_dialog[id]) {
			var window_name = "cancel_donation_dialog_" + id;	// window id
			var window_close = "cancel_donation_dialog_" + id;	// window close button id
	
			// build the modal window (refer to YUI documentation for more information
				YAHOO.dms.cancel_donation_dialog[id] = new YAHOO.widget.Panel(window_name, { 
					width:"240px", 
					height:"100px", 
					fixedcenter:true, 
					close:false, 
					draggable:false, 
					zindex:4,
					modal:true,
					visible:true  } );	
	
				YAHOO.dms.cancel_donation_dialog[id].setHeader("Cancel Donation:");
				YAHOO.dms.cancel_donation_dialog[id].setBody("Are you sure you want to mark this ticket for closing?<br /><input type='button' value='Yes' onclick='window.frames.ticketdonation_window_"+id+".xajax_cancelDonation("+id+")' /><input type='button' value='No' onclick='YAHOO.dms.cancel_donation_dialog[" + id + "].hide()' />");
				YAHOO.dms.cancel_donation_dialog[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.cancel_donation_dialog[id].focus, YAHOO.dms.cancel_donation_dialog[id], true);  
		}	
		else {
			YAHOO.dms.cancel_donation_dialog[id].show();
		}
}

function show_add_agent_confirmation( id ) {
	// check first if the instance of that window exist, if not procede with building the modal confirmation window	
		if (!YAHOO.dms.addagent_confirmation_dialog[id]) {
			var window_name = "addagent_confirmation_" + id;	// window id
			var window_close = "addagent_confirmation_" + id;	// window close button id
			// build the modal window (refer to YUI documentation for more information
				YAHOO.dms.addagent_confirmation_dialog[id] = new YAHOO.widget.Panel(window_name, { 
					width:"240px", 
					height:"100px", 
					fixedcenter:true, 
					close:false, 
					draggable:false, 
					zindex:4,
					modal:true,
					visible:true  } );	
				
				YAHOO.dms.addagent_confirmation_dialog[id].setHeader("Add Agent:");
				YAHOO.dms.addagent_confirmation_dialog[id].setBody("Are you sure you want to add this agent?<br /><input type='button' value='Yes' onclick=\"window.frames.agent_add.xajax_addAgent(window.frames.agent_add.xajax.getFormValues('addAgentForm'))\" /><input type='button' value='No' onclick='YAHOO.dms.addagent_confirmation_dialog[" + id + "].hide()' />");
				//window.frames['add_referral_window_"+id+"'].xajax.getFormValues('referralForm')
				YAHOO.dms.addagent_confirmation_dialog[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.addagent_confirmation_dialog[id].focus, YAHOO.dms.addagent_confirmation_dialog[id], true);  
		}
		else {
			YAHOO.dms.addagent_confirmation_dialog[id].show();
		}	
}

function show_add_ticket_confirmation( id ) {
	// check first if the instance of that window exist, if not procede with building the modal confirmation window	
		if (!YAHOO.dms.ticket_confirmation_dialog[id]) {
			var window_name = "ticket_confirmation_" + id;	// window id
			var window_close = "ticket_confirmation_" + id;	// window close button id
			var path = "window.frames.newticket_window_" + id;
			var parameter = "window.frames.newticket_window_"+id+".xajax.getFormValues('ticketForm')";
			// build the modal window (refer to YUI documentation for more information
				YAHOO.dms.ticket_confirmation_dialog[id] = new YAHOO.widget.Panel(window_name, { 
					width:"240px", 
					height:"100px", 
					fixedcenter:true, 
					close:false, 
					draggable:false, 
					zindex:4,
					modal:true,
					visible:true  } );	
				
				YAHOO.dms.ticket_confirmation_dialog[id].setHeader("Submit Ticket:");
				YAHOO.dms.ticket_confirmation_dialog[id].setBody("Are you sure you want to submit this ticket?<br /><input type='button' value='Yes' onclick=\""+path+".xajax_submitTicket("+parameter+")\" /><input type='button' value='No' onclick='YAHOO.dms.ticket_confirmation_dialog[" + id + "].hide()' />");
				//window.frames['add_referral_window_"+id+"'].xajax.getFormValues('referralForm')
				YAHOO.dms.ticket_confirmation_dialog[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.ticket_confirmation_dialog[id].focus, YAHOO.dms.ticket_confirmation_dialog[id], true);  
		}
		else {
			YAHOO.dms.ticket_confirmation_dialog[id].show();
		}	
}

function show_add_donation_confirmation( id ) {
	// check first if the instance of that window exist, if not procede with building the modal confirmation window	
		if (!YAHOO.dms.add_referral_dialog[id]) {
			var window_name = "add_donation_dialog_" + id;	// window id
			var window_close = "add_donation_dialog_" + id;	// window close button id
		
			// build the modal window (refer to YUI documentation for more information
				YAHOO.dms.add_donation_dialog[id] = new YAHOO.widget.Panel(window_name, { 
					width:"240px", 
					height:"100px", 
					fixedcenter:true, 
					close:false, 
					draggable:false, 
					zindex:4,
					modal:true,
					visible:true  } );	
			
				YAHOO.dms.add_donation_dialog[id].setHeader("Add Donation:");
				YAHOO.dms.add_donation_dialog[id].setBody("Are you sure you want to add this referral client?<br /><input type='button' value='Yes' onclick=\"window.frames.newdonationticket_window_"+id+".xajax_submitDonation(window.frames.newdonationticket_window_"+id+".xajax.getFormValues('donationForm'))\" /><input type='button' value='No' onclick='YAHOO.dms.add_donation_dialog[" + id + "].hide()' />");
				YAHOO.dms.add_donation_dialog[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.add_donation_dialog[id].focus, YAHOO.dms.add_donation_dialog[id], true);  
		}	
		else {
			YAHOO.dms.add_referral_dialog[id].show();
		}
}

function show_add_referral_confirmation( id, type ) {
	// check first if the instance of that window exist, if not procede with building the modal confirmation window	
		if (!YAHOO.dms.add_referral_dialog[id]) {
			var window_name = "add_referral_dialog_" + id;	// window id
			var window_close = "add_referral_dialog_" + id;	// window close button id
		
			// build the modal window (refer to YUI documentation for more information
				YAHOO.dms.add_referral_dialog[id] = new YAHOO.widget.Panel(window_name, { 
					width:"240px", 
					height:"100px", 
					fixedcenter:true, 
					close:false, 
					draggable:false, 
					zindex:4,
					modal:true,
					visible:true  } );	
			
				if (type == 1) {
					YAHOO.dms.add_referral_dialog[id].setHeader("Add Referral");
					YAHOO.dms.add_referral_dialog[id].setBody("Are you sure you want to add this referral client?<br /><input type='button' value='Yes' onclick=\"parent.window.frames['add_referral_window_"+id+"'].xajax_addReferral(parent.window.frames['add_referral_window_"+id+"'].xajax.getFormValues('referralForm'))\" /><input type='button' value='No' onclick='YAHOO.dms.add_referral_dialog[" + id + "].hide()' />");
				}
				else if (type == 2) {
					YAHOO.dms.add_referral_dialog[id].setHeader("Add Client");
					YAHOO.dms.add_referral_dialog[id].setBody("Are you sure you want to add this client?<br /><input type='button' value='Yes' onclick=\"parent.window.frames['client_add'].xajax_addClient(parent.window.frames['client_add'].xajax.getFormValues('addClientForm'))\" /><input type='button' value='No' onclick='YAHOO.dms.add_referral_dialog[" + id + "].hide()' />");
				}
				//window.frames['add_referral_window_"+id+"'].xajax.getFormValues('referralForm')
				YAHOO.dms.add_referral_dialog[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.add_referral_dialog[id].focus, YAHOO.dms.add_referral_dialog[id], true);  
		}	
		else {
			YAHOO.dms.add_referral_dialog[id].show();
		}
}

function show_send_greeting_confirmation( id ) {
	// check first if the instance of that window exist, if not procede with building the modal confirmation window
		if (!YAHOO.dms.greeting_confirmation_dialog[id]) {
			var window_name = "greeting_confirmation_dialog_" + id;	// window id
			var window_close = "greeting_confirmation_dialog_" + id;// window close button id	
	
			// build the modal window (refer to YUI documentation for more information
				YAHOO.dms.greeting_confirmation_dialog[id] = new YAHOO.widget.Panel(window_name, { 
					width:"240px", 
					height:"100px", 
					fixedcenter:true, 
					close:false, 
					draggable:false, 
					zindex:4,
					modal:true,
					visible:true  } );	

				YAHOO.dms.greeting_confirmation_dialog[id].setHeader("Send Email Birthday Greeting:");
				YAHOO.dms.greeting_confirmation_dialog[id].setBody("Are you sure you want to send email birthday greeting?<br /><input type='button' value='Yes' onclick='send_greeting("+id+")' /><input type='button' value='No' onclick='YAHOO.dms.greeting_confirmation_dialog[" + id + "].hide()' />");
				YAHOO.dms.greeting_confirmation_dialog[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.greeting_confirmation_dialog[id].focus, YAHOO.dms.greeting_confirmation_dialog[id], true);  
				//window.frames.notification_window_1.xajax_sendBirthdayGreeting("+id+")
		}	
		else {
			YAHOO.dms.greeting_confirmation_dialog[id].show();
		}
}

function send_greeting( id ) {
	window.frames.notification_window_1.xajax_sendBirthdayGreeting(id);
	YAHOO.dms.greeting_confirmation_dialog[id].close_dialog();	
}

function show_received_confirmation( id ) {
	// check first if the instance of that window exist, if not procede with building the modal confirmation window
		if (!YAHOO.dms.received_confirmation_dialog[id]) {
			var window_name = "received_confirmation_dialog_" + id;	// window id
			var window_close = "received_confirmation_dialog_" + id;// window close button id
	
			// build the modal window (refer to YUI documentation for more information
				YAHOO.dms.received_confirmation_dialog[id] = new YAHOO.widget.Panel(window_name, { 
					width:"240px", 
					height:"100px", 
					fixedcenter:true, 
					close:false, 
					draggable:false, 
					zindex:4,
					modal:true,
					visible:true  } );	
				
				YAHOO.dms.received_confirmation_dialog[id].setHeader("Collection Received Confirmation:");
				YAHOO.dms.received_confirmation_dialog[id].setBody("Are you sure you have received the collection?<br /><input type='button' value='Yes' onclick='' /><input type='button' value='No' onclick='YAHOO.dms.received_confirmation_dialog[" + id + "].hide()' />");
				YAHOO.dms.received_confirmation_dialog[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.received_confirmation_dialog[id].focus, YAHOO.dms.received_confirmation_dialog[id], true);  
		}	
		else {
			YAHOO.dms.received_confirmation_dialog[id].show();
		}
}
/*
function show_ticketdone_confirmation( id ) {
	// check first if the instance of that window exist, if not procede with building the modal confirmation window
		if (!YAHOO.dms.ticketdone_confirmation_dialog[id]) {
			var window_name = "ticketdone_confirmation_dialog_" + id;	// window id
			var window_close = "ticketdone_confirmation_dialog_" + id;// window close button id
	
			// build the modal window (refer to YUI documentation for more information
				YAHOO.dms.ticketdone_confirmation_dialog[id] = new YAHOO.widget.Panel(window_name, { 
					width:"240px", 
					height:"100px", 
					fixedcenter:true, 
					close:false, 
					draggable:false, 
					zindex:4,
					modal:true,
					visible:true  } );	
			
				YAHOO.dms.ticketdone_confirmation_dialog[id].close_dialog = function () {
																YAHOO.dms.ticketdone_confirmation_dialog[id].hide();
																YAHOO.dms.ticketdone_confirmation_dialog[id].destroy();
																YAHOO.dms.ticketdone_confirmation_dialog[id] = null;
															}	
				YAHOO.dms.ticketdone_confirmation_dialog[id].setHeader("Ticket Completion Confirmation:");
				YAHOO.dms.ticketdone_confirmation_dialog[id].setBody("Are you sure you are done with the ticket?<br /><input type='button' value='Yes' onclick='hide_client_item(" + id + ")' /><input type='button' value='No' onclick='YAHOO.dms.ticketdone_confirmation_dialog[" + id + "].close_dialog()' />");
				YAHOO.dms.ticketdone_confirmation_dialog[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.ticketdone_confirmation_dialog[id].focus, YAHOO.dms.ticketdone_confirmation_dialog[id], true);  
		}	
}
*/
function show_done_confirmation( id ) {
	// check first if the instance of that window exist, if not procede with building the modal confirmation window
		if (!YAHOO.dms.done_confirmation_dialog[id]) {
			var window_name = "done_confirmation_dialog_" + id;	// window id
			var window_close = "done_confirmation_dialog_" + id;// window close button id
	
			// build the modal window (refer to YUI documentation for more information
				YAHOO.dms.done_confirmation_dialog[id] = new YAHOO.widget.Panel(window_name, { 
					width:"240px", 
					height:"100px", 
					fixedcenter:true, 
					close:false, 
					draggable:false, 
					zindex:4,
					modal:true,
					visible:true  } );	
				
				YAHOO.dms.done_confirmation_dialog[id].setHeader("Call Complete Confirmation:");
				YAHOO.dms.done_confirmation_dialog[id].setBody("Are you sure you are done with the call?<br /><input type='button' value='Yes' onclick='hide_client_item(" + id + ")' /><input type='button' value='No' onclick='YAHOO.dms.done_confirmation_dialog[" + id + "].hide()' />");
				YAHOO.dms.done_confirmation_dialog[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.done_confirmation_dialog[id].focus, YAHOO.dms.done_confirmation_dialog[id], true);  
		}	
		else {
			YAHOO.dms.done_confirmation_dialog[id].show();
		}
}

function show_error_confirmation( id, string ) {
	// check first if the instance of that window exist, if not procede with building the modal confirmation window
		if (!YAHOO.dms.error_confirmation_dialog[id]) {
			var window_name = "error_confirmation_dialog_" + id;	// window id
			var window_close = "error_confirmation_dialog_" + id;// window close button id
	
			// build the modal window (refer to YUI documentation for more information
				YAHOO.dms.error_confirmation_dialog[id] = new YAHOO.widget.Panel(window_name, { 
					width:"240px", 
					height:"100px", 
					fixedcenter:true, 
					close:false, 
					draggable:false, 
					zindex:4,
					modal:true,
					visible:true  } );	
	
				YAHOO.dms.error_confirmation_dialog[id].setHeader("Error Message:");
				YAHOO.dms.error_confirmation_dialog[id].setBody(" " + string + "<br /><br /><input type='button' value='OK' onclick='YAHOO.dms.error_confirmation_dialog[" + id + "].hide()' />");
				YAHOO.dms.error_confirmation_dialog[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.error_confirmation_dialog[id].focus, YAHOO.dms.error_confirmation_dialog[id], true);  
		}	
		else {
			YAHOO.dms.error_confirmation_dialog[id].show();
		}	
}

//-------------
// OPEN WINDOW 
//-------------

// NOTE: //
// for the sizes of the windows, it's ok to play around with the size, as long as you ADJUST THE SIZE OF THE IFRAME TOO and that everything is seen in the window

function open_donation_ticket( call_id, id, client_id ) {
	// check first if the instance of that window exist, if not procede with building the window
		if (!YAHOO.dms.dashboard_donationticket_windows[id]) {		
			var window_name = "donationticket_window_" + id;		// window id
			var window_close = "donationticket_window_close_" + id;	// window close button id
	
			// build the modal window (refer to YUI documentation for more information
				YAHOO.dms.dashboard_donationticket_windows[id] = new YAHOO.widget.Panel(window_name, { 
					width:"300px", 
					height:"410px", 
					visible:true, 
					constraintoviewport:true, 
					draggable:true, 
					fixedcenter:true, 			
					close:false });	
															
				YAHOO.dms.dashboard_donationticket_windows[id].setHeader("Donation Ticket Review | Donation# " + id);
				
				// set body content
				// contents of this window is an iframe with a UNIQUE ID, and a src .php code: dashboard_ticket_window.php
				// the contents also contain the close button which calls the close method of that specific instance of the window
					YAHOO.dms.dashboard_donationticket_windows[id].setBody("<iframe id='ticketdonation_window_"+id+"' name='ticketdonation_window_"+id+"' src='dashboard/windows/dashboardDonationWindow.php?donation_id="+id+"&client_id="+client_id+"&call_id="+call_id+"' width=300 height=405 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=auto style='overflow-x: hidden;'></iframe>");
				//YAHOO.dms.dashboard_donationticket_windows[id].setFooter("-------");					
	
				YAHOO.dms.dashboard_donationticket_windows[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.dashboard_donationticket_windows[id].focus, YAHOO.dms.dashboard_donationticket_windows[id], true);  
		}
		else {
			YAHOO.dms.dashboard_donationticket_windows[id].show();
		}
}

function open_client_window( id, client_id ) {	//the id used here is the call_id
	// check first if the instance of that window exist, if not procede with building the window
		if (!YAHOO.dms.dashboard_client_windows[id]) {
			var window_name = "client_window_" + id;		// window id
			var window_close = "client_window_close_" + id;	// window close button id
	
			// build the modal window (refer to YUI documentation for more information
				YAHOO.dms.dashboard_client_windows[id] = new YAHOO.widget.Panel(window_name, { 
					width:"600px", 
					height:"500px", 
					visible:true, 
					constraintoviewport:true, 
					draggable:true, 
					fixedcenter:true, 
					close:false  } );	
					
				YAHOO.dms.dashboard_client_windows[id].setHeader("Client Window | Client# " + client_id);
				
				// set body content
				// contents of this window is an iframe with a UNIQUE ID, and a src .php code: dashboard_client_window.php with GET client_id parameter
				// the contents also contain the close button which calls the close method of that specific instance of the window
					YAHOO.dms.dashboard_client_windows[id].setBody("<iframe id='client_window_"+client_id+"' name='view_client_profile_"+client_id+"' src='dashboard/windows/dashboardClientWindow.php?client_id=" + client_id + "' width=590 height=400 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=auto style='overflow-x: hidden;'></iframe> <br><input type='button' onclick='YAHOO.dms.dashboard_client_windows[" + id + "].hide()' value='Close'/><input type='button' value='New Ticket' onclick='open_newticket_window(" + id + ", " + client_id + ")' /><input type='button' value='Add Referral' onclick='open_newreferral_window(" + client_id + ")' /> <input type='button' id='donationButton' onclick='parent.open_newdonation_window("+client_id+", "+id+")' value='Donate'/>");
				//YAHOO.dms.dashboard_client_windows[id].setFooter("-------");					
	
				YAHOO.dms.dashboard_client_windows[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.dashboard_client_windows[id].focus, YAHOO.dms.dashboard_client_windows[id], true);  
		}	
		else {
			YAHOO.dms.dashboard_client_windows[id].show();
		}		
}

function open_profile_window( id ) { // the id used here is the client_id
	// check first if the instance of that window exist, if not procede with building the window
		if (!YAHOO.dms.dashboard_clientprofile_windows[id]) {		
			var window_name = "clientprofile_window_" + id;			// window id
			var window_close = "clientprofile_window_close_" + id;	// window close button id
	
			// build the modal window (refer to YUI documentation for more information
				YAHOO.dms.dashboard_clientprofile_windows[id] = new YAHOO.widget.Panel(window_name, { 
					width:"600px", 
					height:"500px", 
					visible:true, 
					constraintoviewport:true, 
					draggable:true, 
					fixedcenter:true, 
					close:false });	
					
				YAHOO.dms.dashboard_clientprofile_windows[id].setHeader("Client Profile Window | Client# " +id);
				// set body content
				// contents of this window is an iframe with a UNIQUE ID, and a src .php code: dashboard_client_window.php with GET client_id parameter
				// the contents also contain the close button which calls the close method of that specific instance of the window
					YAHOO.dms.dashboard_clientprofile_windows[id].setBody("<iframe id='clientprofile_window_" + id + "' name='view_client_profile_"+id+"' src='dashboard/windows/dashboardClientWindow.php?client_id= " + id + "' width=590 height=400 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=auto style='overflow-x: hidden;'></iframe> <br><input type='button' onclick='YAHOO.dms.dashboard_clientprofile_windows[" + id + "].hide()' value='Close'/>");
				//YAHOO.dms.dashboard_clientprofile_windows[id].setFooter("-------");					
	
				YAHOO.dms.dashboard_clientprofile_windows[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.dashboard_clientprofile_windows[id].focus, YAHOO.dms.dashboard_clientprofile_windows[id], true);  
		}
		else {
			YAHOO.dms.dashboard_clientprofile_windows[id].show();
		}
}
	
function open_notification_window( id, window_id ) {
	// check first if the instance of that window exist, if not procede with building the window
		if (!YAHOO.dms.dashboard_notification_windows[id]) {			
			var window_name = "notification_window_" + id;			// window id
			var window_close = "notification_window_close_" + id;	// window close button id
	
			// build the modal window (refer to YUI documentation for more information
				YAHOO.dms.dashboard_notification_windows[id] = new YAHOO.widget.Panel(window_name, { 
					width:"300px", 
					height:"400px", 
					visible:true, 
					constraintoviewport:true, 
					draggable:true, 
					fixedcenter:true, 
					close:false });	
			
				YAHOO.dms.dashboard_notification_windows[id].setHeader("Notification Window: " + window_id);
				// set body content
				// contents of this window is an iframe with a UNIQUE ID, and a src .php code: dashboard_notification_window.php with GET notification_id parameter
				// the contents also contain the close button which calls the close method of that specific instance of the window
					YAHOO.dms.dashboard_notification_windows[id].setBody("<iframe id='notification_window_" + id + "' name='notification_window_" + id + "' src='dashboard/windows/dashboardNotificationWindow.php?notification_window_id= " + id + "' width=280 height=325 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=auto style='overflow-x: hidden;'></iframe> <br><input type='button' onclick='YAHOO.dms.dashboard_notification_windows[" + id + "].hide()' value='Close'/>");
				//YAHOO.dms.dashboard_notification_windows[id].setFooter("-------");					
	
				YAHOO.dms.dashboard_notification_windows[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.dashboard_notification_windows[id].focus, YAHOO.dms.dashboard_notification_windows[id], true);  
		}
		else {
			YAHOO.dms.dashboard_notification_windows[id].show();
		}
}

function open_ticket_window( id ) {	
	// check first if the instance of that window exist, if not procede with building the window
		if (!YAHOO.dms.dashboard_ticket_windows[id]) {		
			var window_name = "ticket_window_" + id;		// window id
			var window_close = "ticket_window_close_" + id;	// window close button id
	
			// build the modal window (refer to YUI documentation for more information
				YAHOO.dms.dashboard_ticket_windows[id] = new YAHOO.widget.Panel(window_name, { 
					width:"300px", 
					height:"300px", 
					visible:true, 
					constraintoviewport:true, 
					draggable:true, 
					fixedcenter:true, 
					close:false  } );	
			
				YAHOO.dms.dashboard_ticket_windows[id].setHeader("Ticket Review Window | Ticket# " +id);
				// set body content
				// contents of this window is an iframe with a UNIQUE ID, and a src .php code: dashboard_ticket_window.php with GET client_id parameter
				// the contents also contain the close button which calls the close method of that specific instance of the window
					YAHOO.dms.dashboard_ticket_windows[id].setBody("<iframe id='ticket_window_" + id + "' src='dashboard/windows/dashboardTicketWindow.php?ticket_id= " + id + "' width=280 height=205 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=auto style='overflow-x: hidden;'></iframe> <br><input type='button' onclick='YAHOO.dms.dashboard_ticket_windows[" + id + "].hide()' value='Close'/>");
				//YAHOO.dms.dashboard_ticket_windows[id].setFooter("-------");					
	
				YAHOO.dms.dashboard_ticket_windows[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.dashboard_ticket_windows[id].focus, YAHOO.dms.dashboard_ticket_windows[id], true);  
		}
		else {
			YAHOO.dms.dashboard_ticket_windows[id].show();
		}
}

function open_donation_window( id ) {	
	// check first if the instance of that window exist, if not procede with building the window
		if (!YAHOO.dms.dashboard_donation_windows[id]) {		
			var window_name = "donation_window_" + id;		// window id
			var window_close = "donation_window_close_" + id;	// window close button id
	
			// build the modal window (refer to YUI documentation for more information
				YAHOO.dms.dashboard_donation_windows[id] = new YAHOO.widget.Panel(window_name, { 
					width:"300px", 
					height:"300px", 
					visible:true, 
					constraintoviewport:true, 
					draggable:true, 
					fixedcenter:true, 
					close:false  } );	
			
				YAHOO.dms.dashboard_donation_windows[id].setHeader("Donation Review Window: ");
				// set body content
				// contents of this window is an iframe with a UNIQUE ID, and a src .php code: dashboard_ticket_window.php with GET client_id parameter
				// the contents also contain the close button which calls the close method of that specific instance of the window
					YAHOO.dms.dashboard_donation_windows[id].setBody("<iframe id='donation_window_" + id + "' src='dashboard/windows/dashboardDonationWindow.php?donation_id= " + id + "' width=280 height=205 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=auto style='overflow-x: hidden;'></iframe> <br><input type='button' onclick='YAHOO.dms.dashboard_donation_windows[" + id + "].hide()' value='Close'/>");
				//YAHOO.dms.dashboard_ticket_windows[id].setFooter("-------");					
	
				YAHOO.dms.dashboard_donation_windows[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.dashboard_donation_windows[id].focus, YAHOO.dms.dashboard_donation_windows[id], true);  
		}
		else {
			YAHOO.dms.dashboard_donation_windows[id].show();
		}
}

function open_transaction_window( id ) {	
	// check first if the instance of that window exist, if not procede with building the window
		if (!YAHOO.dms.dashboard_transaction_windows[id]) {		
			var window_name = "transaction_window_" + id;		// window id
			var window_close = "transaction_window_close_" + id;	// window close button id
	
			// build the modal window (refer to YUI documentation for more information
				YAHOO.dms.dashboard_transaction_windows[id] = new YAHOO.widget.Panel(window_name, { 
					width:"300px", 
					height:"300px", 
					visible:true, 
					constraintoviewport:true, 
					draggable:true, 
					fixedcenter:true, 
					close:false  } );	
			
				YAHOO.dms.dashboard_transaction_windows[id].setHeader("Transaction Review Window | Transaction# "+id);
				// set body content
				// contents of this window is an iframe with a UNIQUE ID, and a src .php code: dashboard_ticket_window.php with GET client_id parameter
				// the contents also contain the close button which calls the close method of that specific instance of the window
					YAHOO.dms.dashboard_transaction_windows[id].setBody("<iframe id='transaction_window_" + id + "' src='dashboard/windows/dashboardTransactionWindow.php?transaction_id= " + id + "' width=280 height=205 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=auto style='overflow-x: hidden;'></iframe> <br><input type='button' onclick='YAHOO.dms.dashboard_transaction_windows[" + id + "].hide()' value='Close'/>");
				//YAHOO.dms.dashboard_ticket_windows[id].setFooter("-------");					
	
				YAHOO.dms.dashboard_transaction_windows[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.dashboard_transaction_windows[id].focus, YAHOO.dms.dashboard_transaction_windows[id], true);  
		}
		else {
			YAHOO.dms.dashboard_transaction_windows[id].show();
		}
}

function open_newticket_window( id, client_id ) {	// the id used here is the call_id
	// check first if the instance of that window exist, if not procede with building the window
		if (!YAHOO.dms.dashboard_newticket_windows[id]) {		
			var window_name = "newticket_window_" + id;			// window id
			var window_close = "newticket_window_close_" + id;	// window close button id
	
			// build the modal window (refer to YUI documentation for more information
				YAHOO.dms.dashboard_newticket_windows[id] = new YAHOO.widget.Panel(window_name, { 
					width:"300px", 
					height:"370px", 
					visible:true, 
					constraintoviewport:true, 
					draggable:true, 
					fixedcenter:true, 
					close:false });	
			
				YAHOO.dms.dashboard_newticket_windows[id].setHeader("New Ticket Window: ");
				// set body content
				// contents of this window is an iframe with a UNIQUE ID, and a src .php code: dashboard_ticket_window.php
				// the contents also contain the close button which calls the close method of that specific instance of the window
					YAHOO.dms.dashboard_newticket_windows[id].setBody("<iframe name='newticket_window_" + id + "' src='dashboard/windows/dashboardTicketWindow.php?client_id=" + client_id + "&call_id=" + id + "' width=280 height=350 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 border=0 scrolling=auto style='overflow-x: hidden;'></iframe> <br>");
				//YAHOO.dms.dashboard_newticket_windows[id].setFooter("-------");					
	
				YAHOO.dms.dashboard_newticket_windows[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.dashboard_newticket_windows[id].focus, YAHOO.dms.dashboard_newticket_windows[id], true);  
		}
		else {
			YAHOO.dms.dashboard_newticket_windows[id].show();
		}
}

function open_newdonation_window( id, call_id ) { // the id used here is the client_id
	// check first if the instance of that window exist, if not procede with building the window
		if (!YAHOO.dms.dashboard_newdonationticket_windows[id]) {		
			var window_name = "newdonationticket_window_" + id;			// window id
			var window_close = "newdonationticket_window_close_" + id;	// window close button id
	
			// build the modal window (refer to YUI documentation for more information
				YAHOO.dms.dashboard_newdonationticket_windows[id] = new YAHOO.widget.Panel(window_name, { 
					width:"300px", 
					height:"360px", 
					visible:true, 
					constraintoviewport:true, 
					draggable:true, 
					fixedcenter:true, 
					close:false });	

				YAHOO.dms.dashboard_newdonationticket_windows[id].setHeader("New Donation Window: ");
				// set body content
				// contents of this window is an iframe with a UNIQUE ID, and a src .php code: dashboard_ticket_window.php
				// the contents also contain the close button which calls the close method of that specific instance of the window
				YAHOO.dms.dashboard_newdonationticket_windows[id].setBody("<iframe id='newdonationticket_window_" + id + "' name='newdonationticket_window_" + id + "' src='dashboard/windows/dashboardDonationWindow.php?client_id=" + id + "&call_id=" + id + "' width=280 height=350 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 border=0 scrolling=auto style='overflow-x: hidden;'></iframe> <br>");
				//YAHOO.dms.dashboard_newticket_windows[id].setFooter("-------");					
	
				YAHOO.dms.dashboard_newdonationticket_windows[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.dashboard_newdonationticket_windows[id].focus, YAHOO.dms.dashboard_newdonationticket_windows[id], true);  
		}
		else {
			YAHOO.dms.dashboard_newdonationticket_windows[id].show();
		}
}

function open_newtransaction_window( id ) { // the id that is used here is the donation id	
	// check first if the instance of that window exist, if not procede with building the window
		if (!YAHOO.dms.dashboard_newtransactionticket_windows[id]) {		
			var window_name = "newtransactionticket_window_" + id;			// window id
			var window_close = "newtransactionticket_window_close_" + id;	// window close button id
	
			// build the modal window (refer to YUI documentation for more information
				YAHOO.dms.dashboard_newtransactionticket_windows[id] = new YAHOO.widget.Panel(window_name, { 
					width:"300px", 
					height:"340px", 
					visible:true, 
					constraintoviewport:true, 
					draggable:true, 
					fixedcenter:true, 
					close:false });	
	
				YAHOO.dms.dashboard_newtransactionticket_windows[id].setHeader("New Transaction Window: | Donation#: " + id);
				// set body content
				// contents of this window is an iframe with a UNIQUE ID, and a src .php code: dashboard_ticket_window.php
				// the contents also contain the close button which calls the close method of that specific instance of the window
				YAHOO.dms.dashboard_newtransactionticket_windows[id].setBody("<iframe id='newtransactionticket_window_" + id + "' src='dashboard/windows/dashboardTransactionWindow.php?donation_id=" + id + "' width=280 height=260 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 border=0 scrolling=auto style='overflow-x: hidden;'></iframe><input type='button' onclick='YAHOO.dms.dashboard_newtransactionticket_windows[" + id + "].hide()' value='Close'/>");
				//YAHOO.dms.dashboard_newticket_windows[id].setFooter("-------");					
	
				YAHOO.dms.dashboard_newtransactionticket_windows[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.dashboard_newtransactionticket_windows[id].focus, YAHOO.dms.dashboard_newtransactionticket_windows[id], true);  
		}
		else {
			YAHOO.dms.dashboard_newtransactionticket_windows[id].show();
		}
}

function open_newreferral_window( id ) { // the id used here is the client_id
	// check first if the instance of that window exist, if not procede with building the window
		if (!YAHOO.dms.dashboard_newreferral_windows[id]) {		
			var window_name = "newreferral_window_" + id;			// window id
			var window_close = "newreferral_window_close_" + id;	// window close button id
	
			// build the modal window (refer to YUI documentation for more information
				YAHOO.dms.dashboard_newreferral_windows[id] = new YAHOO.widget.Panel(window_name, { 
					width:"250px", 
					height:"220px", 
					visible:true, 
					constraintoviewport:true, 
					draggable:true, 
					fixedcenter:true, 
					close:false });	
			
				YAHOO.dms.dashboard_newreferral_windows[id].setHeader("New Referral Window: ");
				// set body content
				// contents of this window is an iframe with a UNIQUE ID, and a src .php code: dashboard_referral_window.php
				// the contents also contain the close button which calls the close method of that specific instance of the window
					YAHOO.dms.dashboard_newreferral_windows[id].setBody("<iframe name='add_referral_window_"+id+"' src='dashboard/windows/dashboardReferralWindow.php?client_id="+id+"' width=230 height=180  marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 border=0 scrolling=auto style='overflow-x: hidden;'></iframe>");
				//YAHOO.dms.dashboard_newreferral_windows[id].setFooter("-------");					
	
				YAHOO.dms.dashboard_newreferral_windows[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.dashboard_newreferral_windows[id].focus, YAHOO.dms.dashboard_newreferral_windows[id], true);  
		}
		else {
			YAHOO.dms.dashboard_newreferral_windows[id].show();
		}
}

function open_reschedule_window( id, client_id, call_id ) {	// the id used here is the donation_id
	// check first if the instance of that window exist, if not procede with building the window
		if (!YAHOO.dms.dashboard_reschedule_windows[id]) {		
			var window_name = "reschedule_window_" + id;		// window id
			var window_close = "reschedule_window_close_" + id;	// window close button id
	
			// build the modal window (refer to YUI documentation for more information
				YAHOO.dms.dashboard_reschedule_windows[id] = new YAHOO.widget.Panel(window_name, { 
					width:"250px", 
					height:"135px", 
					visible:true, 
					constraintoviewport:true, 
					draggable:true, 
					fixedcenter:true, 
					close:false });	
			
				YAHOO.dms.dashboard_reschedule_windows[id].setHeader("Pickup Reschedule: ");
				// set body content
				// contents of this window is an iframe with a UNIQUE ID, and a src .php code: dashboard_reschedule_window.php with GET client_id parameter
				// the contents also contain the close button which calls the close method of that specific instance of the window
					YAHOO.dms.dashboard_reschedule_windows[id].setBody("<iframe id='reschedule_window_" + id + "' name='reschedule_window_" + id + "' src='dashboard/windows/dashboardRescheduleWindow.php?donation_id=" + id + "&call_id="+call_id+"&client_id="+client_id+"' width=230 height=100  marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=auto style='overflow-x: hidden;'></iframe>");
				//YAHOO.dms.dashboard_newreferral_windows[id].setFooter("-------");					
	
				YAHOO.dms.dashboard_reschedule_windows[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.dashboard_reschedule_windows[id].focus, YAHOO.dms.dashboard_reschedule_windows[id], true);  
		}
		else {
			YAHOO.dms.dashboard_reschedule_windows[id].show();
		}
}

function open_discontinuation_window( id, client_id ) { // the id used here is the donation id
	// check first if the instance of that window exist, if not procede with building the window
		if (!YAHOO.dms.dashboard_discontinuation_windows[id]) {		
			var window_name = "discontinuation_window_" + id;		// window id
			var window_close = "discontinuation_window_close_" + id;	// window close button id
	
			// build the modal window (refer to YUI documentation for more information
				YAHOO.dms.dashboard_discontinuation_windows[id] = new YAHOO.widget.Panel(window_name, { 
					width:"300px", 
					height:"210px", 
					visible:true, 
					constraintoviewport:true, 
					draggable:true, 
					fixedcenter:true, 			
					close:false });	
															
				YAHOO.dms.dashboard_discontinuation_windows[id].setHeader("Discontinuation Donation | Donation# " + id);
				
				// set body content
				// contents of this window is an iframe with a UNIQUE ID, and a src .php code: dashboard_ticket_window.php
				// the contents also contain the close button which calls the close method of that specific instance of the window
					YAHOO.dms.dashboard_discontinuation_windows[id].setBody("<iframe id='discontinuation_window_" + id + "' name='discontinuation_window_" + id + "' src='dashboard/windows/discontinuationDonationWindow.php?donation_id=" + id + "&client_id="+client_id+"' width=230 height=200  marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=auto style='overflow-x: hidden;'></iframe>");
				//YAHOO.dms.dashboard_donationticket_windows[id].setFooter("-------");					
	
				YAHOO.dms.dashboard_discontinuation_windows[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.dashboard_discontinuation_windows[id].focus, YAHOO.dms.dashboard_discontinuation_windows[id], true);  
		}
		else {
			YAHOO.dms.dashboard_discontinuation_windows[id].show();
		}
}
